package com.toannv.card;

import java.util.Random;
import java.util.Stack;


public class CardsList {
	
	public static  void sort(Integer[] values) {
        int i;
        int rand;
        Integer temp;
        Random random;

        random = new Random(System.currentTimeMillis());
        for (i = 0; i < values.length; i++) {
            rand = (random.nextInt() & 0x7FFFFFFF) % values.length;
            temp = values[i];
            values[i] = values[rand];
            values[rand] = temp;
        }
    }
	
	public static Stack<card> ListOfCard(){
		
		Integer[] cardslist = { 0, 1, 2, 3, 4, 5, 6, 7, 8 , 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
				31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51};
		
		Stack<card> cardStack = new Stack<card>();
		
		sort(cardslist);
		
		for(Integer i: cardslist) {
			int number = (cardslist[i]+1)%13 + 1;
			int poker = (cardslist[i]+1)%4 + 1;
            card OneCard = new card(number, poker);
            cardStack.push(OneCard);
        }
		
		return cardStack;
	}
}
